// src/APP.vue

<template>
  <div ref="root">This is a root element</div>
</template>

<script lang="ts">
import { onMounted, ref } from 'vue'

export default {
  name: 'APP',
  setup() {
    const root = ref(null)

    onMounted(() => {
      // DOM元素将在初始渲染后分配给ref
      console.log(root.value) // <div>这是根元素</div>
    })

    return {
      root
    }
  }
}
</script>